﻿@using Easy.Web.CMS
@using Easy.Web.CMS.Widget
@model DesignWidgetViewModel
<div @(Model.Widget.StyleClassResult(true))
     id="widget_@Model.Widget.ID"
     data-widgetid="@Model.Widget.ID">
    <div class="zoneToolbar @(Model.Widget.LayoutID.IsNullOrEmpty() ? "blue" : "green")">
        <div class="tools clearfix sort-handle">
            <div class="pull-left">
                <span>
                    <i class="glyphicon glyphicon-move ">
                    </i>
                    @if (Model.Widget.LayoutID.IsNotNullAndWhiteSpace())
                    {
                        <span class="badge">布局</span>
                    }
                    @Model.Widget.WidgetName
                </span>
            </div>
            <div class="pull-right">
                <a href="@Url.Action("Edit", "Widget", new {module = "admin", ID = Model.Widget.ID, ReturnUrl = Url.Action("Design", "Page", new {ID = Model.PageID})})"><i class="glyphicon glyphicon-edit"></i></a>
                <a href="javascript:void(0)" class="delete"
                   data-url="@Url.Action("DeleteWidget", "Widget", new {module = "admin"})"
                   data-id="@Model.Widget.ID"><i class="glyphicon glyphicon-trash"></i></a>
            </div>
        </div>
    </div>
    @if (Model.Widget.Title.IsNotNullAndWhiteSpace())
    {
        <div class="panel panel-default">
            <div class="panel-heading">
                @Model.Widget.Title
            </div>
            <div class="panel-body">
                @Html.DisPlayWidget(Model)
            </div>
        </div>
    }
    else
    {
        @Html.DisPlayWidget(Model)
    }
</div>